home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
dir
/
browser2.41
/
c
/
wbinfo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-24
|
2KB
|
82 lines
/*
* WBInfo.c - Copyright © 1991 by Devil's child.
*
* Created: 24 Jun 1993 21:38:57
* Modified: 24 Jun 1993 21:43:27
*
* Make>> sc <file>.c
* Make>> slink <file>.o SC SD ND BATCH NOICONS TO <file>
*/
#define VERSION "1.0"
static const char version[] = "\0$VER: wbinfo " VERSION " (24.06.93)";
#define TEMPLATE "NAME/A,PUBSCREEN/K"
#define ARG_NAME 0
#define ARG_SCREEN 1
long wbinfo(void)
{
long rc = RETURN_OK;
struct ExecBase *SysBase = *((struct ExecBase **) 4L);
struct Library *DOSBase;
struct Library *WorkbenchBase;
struct Library *IntuitionBase;
char *options[2] = {0, 0};
struct RDArgs *args;
if (!(DOSBase = OpenLibrary("dos.library", 39)))
return RETURN_FAIL;
WorkbenchBase = OpenLibrary("workbench.library", 39);
IntuitionBase = OpenLibrary("intuition.library", 39);
if (!WorkbenchBase || !IntuitionBase)
return RETURN_FAIL;
if (args = ReadArgs(TEMPLATE, (long *)options, NULL)) {
struct Screen *screen = LockPubScreen(options[ARG_SCREEN]);
if (screen) {
BPTR lock = Lock(options[ARG_NAME], ACCESS_READ);
if (lock) {
BPTR par;
par = ParentDir(lock);
if (!par)
par = DupLock(lock); /* for Devices */
WBInfo(par, options[ARG_NAME], screen);
if (par)
UnLock(par);
UnLock(lock);
}
else {
PrintFault(IoErr(), options[ARG_NAME]);
rc = RETURN_ERROR;
}
UnlockPubScreen(NULL, screen);
}
else {
/* error message for 'pubscreen not found' */
if (options[ARG_SCREEN])
PrintFault(ERROR_OBJECT_NOT_FOUND, options[ARG_SCREEN]);
rc = RETURN_FAIL;
}
FreeArgs(args);
}
else {
PrintFault(IoErr(), NULL);
rc = RETURN_ERROR;
}
CloseLibrary(WorkbenchBase);
CloseLibrary(IntuitionBase);
CloseLibrary(DOSBase);
return rc;
}